/*
 * @Descripttion: 
 * @version: V1.0.0
 * @Author: LeonHe
 * @Date: YUYIN_PULSE_TIME21-10-10 19:55:25
 * @LastEditTime: YUYIN_PULSE_TIME21-10-11 23:04:10
 */

#include "YX040.h"
#include "gpio.h"
#include "time.h"

#include "atom.h"
#include "atomport-private.h"

#define YUYIN_PULSE_TIME 5

uint8_t gYuyinIndex = 0;

void yuyinPlay(uint8_t index)
{
    uint8_t i = 0;

    //复位脉冲计数
    GPIO_YUYIN_RESET(1);
    atomTimerDelay(YUYIN_PULSE_TIME);
    GPIO_YUYIN_RESET(0);
    atomTimerDelay(YUYIN_PULSE_TIME);

    GPIO_YUYIN_PULSE(1);
    atomTimerDelay(YUYIN_PULSE_TIME);
    GPIO_YUYIN_PULSE(0);
    atomTimerDelay(YUYIN_PULSE_TIME);
    //输出脉冲
    for(i = 0; i < index; i++)
    {
        GPIO_YUYIN_PULSE(1);
        atomTimerDelay(YUYIN_PULSE_TIME);
        GPIO_YUYIN_PULSE(0);
        atomTimerDelay(YUYIN_PULSE_TIME);
    }
}

